package com.yueke.gemini.controller;


import com.yueke.gemini.annotation.GeminiAutowired;
import com.yueke.gemini.annotation.GeminiRequestMapping;
import com.yueke.gemini.annotation.GeminiRequestParam;
import com.yueke.gemini.service.GeminiService;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

/**
 *  简单的demo
 *  created by admin 2020/3/28 10:34
 */
@com.yueke.gemini.annotation.GeminiController
@GeminiRequestMapping("/james")
public class GeminiController {

    @GeminiAutowired("geminiService")
    private GeminiService geminiService;

    @GeminiRequestMapping("/query")
    public void query(HttpServletRequest request, HttpServletResponse response,
                      @GeminiRequestParam("name") String name, @GeminiRequestParam("age") String age) {

        try {
            PrintWriter pw = response.getWriter();
            String result = geminiService.query(name,age);
            pw.write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }


}
